package apis

import (
	"github.com/gin-gonic/gin"
	"github.com/go-admin-team/go-admin-core/sdk/pkg"
	jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
	"tuowei.com/app/admin/models"
)

type base struct {
}

func (b base) GetUser(ctx *gin.Context) *models.SysUser {
	value, _ := ctx.Get(jwt.JwtPayloadKey)
	m := value.(jwt.MapClaims)
	var obj models.SysUser
	obj.UserId = int(m["identity"].(float64))
	orm, _ := pkg.GetOrm(ctx)
	orm.Find(&obj)
	return &obj
}
